package com.iot08.api.service;

import com.iot08.common.entity.app.*;
import com.iot08.common.service.base.BaseService;
import com.iot08.common.utils.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author cwj
 * @description
 * @date 2025/7/10 9:41
 **/
@Slf4j
@Service
public class SensitivityFileSingleMessageService extends BaseService<SensitivityFileSingleMessage> {


    /**
     * @description 保存单聊敏感信息
     * @author cwj
     * @param [groupId, chatGroupMessage]
     * @return void
     * @date @time 2025/7/10 9:46
     **/
    public void saveData(String groupId, SingleChatGroupMessage chatGroupMessage){
        SensitivityFileSingleMessage sfsm = new SensitivityFileSingleMessage();
        sfsm.setGroupid(groupId);
        sfsm.setSendType(chatGroupMessage.getSendType());
        sfsm.setAvator(chatGroupMessage.getAvator());
        sfsm.setSender(chatGroupMessage.getSender());
        sfsm.setChatReportTime(chatGroupMessage.getChatReportTime());
        sfsm.setIsExceedLimitRecord(chatGroupMessage.getIsExceedLimitRecord());
        sfsm.setMessageType(chatGroupMessage.getMessageType());
        sfsm.setContent(chatGroupMessage.getContent());
        sfsm.setSize(chatGroupMessage.getSize());
        sfsm.setDuration(chatGroupMessage.getDuration());
        sfsm.setExpiryAt(DateUtil.getSystemExpiryAt());
        sfsm.setTimestamp(DateUtil.nowTimestampToDouble());
        this.save(sfsm);
    }
    
}
